Send As SMS

Ubuntu Server System Administration

This blog has been setup to help system administrators move to a Ubuntu Linux server.

Tuesday, November 07, 2006

Enabling root, Configuring Files Using vi, Starting/Stopping/Restarting Services, & Installing Some Software

Okay let's just jump right into it. First we are going to enable the root user, know normally this is frowned upon but since we are using the server edition and should only be accessed by system administrators we should be okay enabling the root user.

Enabling root Account:

Type sudo passwd root, you will then be asked to enter password this is your user password that you assigned durning the installation.

Next you will be asked to Enter new UNIX Password, this is going to be the password for the root account so make it different then your user account. Once you entered the password you will hit enter and be asked to re-enter your root password and hit enter again. Now you will be back to your command prompt.

Now to enter the root account simply type su and hit enter. Enter the root account password and hit enter again. Your are now in root. You will have access to the entire filesystem and edit or delete any file or folder. So from here on in be very careful with what you do and before editing any file or deleting any file make a backup of it. To do this simply type this command:

cp filename filename.bak

This will copy the file and add the extension .bak that stands for backup.

To restore the file simply delete the corrupted file and replace with the backup file by typing the following commands:

rm filename
cp .bak filename


That's it.

Editing files using the vi command

Okay when we did the installation of Ubuntu we let the installation just go with a DHCP assigned IP address, but since we are working with a server we don't want it to change IP addresses. So we are going to edit the interfaces file to make it a static IP address. A few things you will need is a IP address that is not being used, Subnet Mask, Default Gateway address, and DNS Server IP address. Now to edit this file just type:

vi /etc/network/interfaces


Now make the file look like this to this press the Insert key to enter edit mode:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.0.1

Now once you have made all the changes to the file you need to save it by going a :wq
and that is it.

Now we are going to edit the hosts file the same way.

vi /etc/hosts

Now make the file look like this:

127.0.0.1 localhost.localdomain localhost
192.168.0.100 server1.example.com server1

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Then save the host file like you saved the interface file and your are done with the hosts file.

Lastly we are going to edit the sources file so you can broaden your selection of installable packages through the Ubuntu repositories. Edit the following file:

vi /etc/apt/sources.list

Now make the file look like this:

#
# deb cdrom:[Ubuntu-Server 6.06 _Dapper Drake_ - Release i386 (20060531)]/ dapper main
restricted

# deb cdrom:[Ubuntu-Server 6.06 _Dapper Drake_ - Release i386 (20060531)]/ dapper main
restricted

deb http://de.archive.ubuntu.com/ubuntu/ dapper main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ dapper main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ dapper-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ dapper-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://us.archive.ubuntu.com/ubuntu/ dapper universe
deb-src http://us.archive.ubuntu.com/ubuntu/ dapper universe

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse


deb http://security.ubuntu.com/ubuntu dapper-security main restricted
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted
deb http://security.ubuntu.com/ubuntu dapper-security universe
deb-src http://security.ubuntu.com/ubuntu dapper-security universe

Now save this file and quit vi.

Starting/Stopping/Restarting Services

Since we changed the interface configuration file we need to restart the networking service. This is easily done by typing the following command:

/etc/init.d/networking restart

This will restart the networking service and if anything goes wrong it will fail. If everything goes right it will say ok.

You will be starting/stopping/restarting services all through this guide so for right now we will end this section of this post.

Installing Some Software

Since we also edited the sources file we need to know update it and upgrade the distrubition. Do this by typing the following commands:

apt-get update

Once this command is done running you then want to type :

apt-get upgrade

This take a little to run but it will upgrade your entire system.

Once this upgrade is complete we want to be able remotely access this server so we are going to install some software packages called ssh which stands for Secure Shell. To do this enter the following command:

apt-get install ssh openssh-server

You will be asked if you wish to continue by entering a Y and hitting enter.

Once this install is complete you will be able to access this server from anywhere by using a terminal or a program PuTTy.

Now let's install a series of packages called a LAMP stack. To do this enter this command:

apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

Once again you will be asked if you want to continue just reply with a Y and hit enter.

You now have a fully functional Apache Web Server that supports PHP5 and a MySQL Server. The only thing left to do is to set the root password for MySQL Server. Please note this root password is solely for the SQL server and does not change the root password for the entire system. To do this type the following commands:

mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('areallygoodpassword');
quit

This completes this posting of enabling root, configuring files using vi, starting/stopping/restarting services, and installing some software. From here we are going to contain the posts to specific parts of the server. So you will be able to pick and choose what you want to actually do with the server. For example you may just want to have a web server in which case you may only want to go as far as the next post. You may want to have a email and web server so you will have to have the next two posts and so far and so on.

Till next time.

Tuesday, October 24, 2006

Ubuntu Linux Server 6.06 LTS (Dapper Drake) Base Installation

First things first you must download the Ubuntu Server Server 6.06 LTS (Dapper Draker) ISO, you can do that by clicking here. Next using your cd-burning software burning this file to CD as an image, if just copy the file to the CD it will not be bootable. YOU MUST BURN IT AS AN IMAGE. I know my first time burning an ISO I just copied it to the CD and scratched my head as to way it didn't work, that is because when you boot your computer it looks for an install image.

Now, I have a spare computer that I can use to do whatever I want. I do not suggest trying to install this on a computer that you absolutely need, get an old computer and it doesn't have to be anything special just make sure it meets the system requirements that you can find here.

Okay, so now we have the computer that we are going to install our operating system on. First we should go into the BIOS and change our boot order. To do this when the computer first boots up you will see somewhere on the screen "To Enter Setup Press F8" or something to that effect. You may have to reboot your computer several times in order to see it, it will go by pretty fast depending on your systems speed. Once you are in the Setup find under the menus Boot Order or Boot Priority and set it to look something like this:

1st: CD-ROM
2nd: Hard Disk
3rd: Floppy (if you have one)

Now insert you CD into the CD-ROM and press F10 to save changes and it will ask are you sure just hit yes and the computer will reboot.

Once your computer reboots it will boot into a menu that has 6 options:

Install to the hard disk
Install a LAMP server
Check CD for defects
Rescue a broken system
Memory test
Boot from first hard disk

There are two options that we want to do, first Check CD for defects, to do this just use arrow down key until that option is highlighted, and press Enter. It will run a process, once this done press Enter to Continue. The computer will reboot and bring you back to the main menu again.

Now we are going to choose the option Install to the hard disk, by simple pressing Enter. Now the fun really starts. You are going to be guided through a series of questions. I am going to list those questions and give my anwsers as examples. Please adjust your answers to what you prefer.

1.) Choose a language: English
2.) Choose your location: United States
3.) Your keyboard is: American English

Now the installation is going to scan your CD-ROM, then load additional components, then it will configure your network card with DHCP. This is where you have an option, you can cancel the DHCP configuration process and you can configure your network manually with a static IP address. There is a series of questions that walks you through setting up your static IP address. For now we will continue with the DHCP setting. Now time for some more questions.

4.) Hostname: server1 (this is the example replace it with whatever you want)
5.) Disk space to partition: Erase entire disk: (then whatever hard dive your system has)
6.) Write the changes to disks? Yes
7.) Is the system clock set to UTC? Yes
8.) Full name for the new user: Administrator (or whatever you want)
9.) Username for your account: admin (or whatever you want)
10.) Choose a password for the new user: agoodpassword (make this something you know)
11.) Re-enter password to verify: agoodpassword (make the same as the pervious question)

Now the installation will do the following:

Install the base system
Configure apt
Select and install software
Install GRUB boot loader
Finish the installation

Now the installation will tell you that it complete and ask you to either Go Back or Continue, it will also eject the CD-ROM. Take the CD-ROM out and select Continue if it is not already selected and hit Enter.

You system will now reboot into your new Ubuntu Server!

In the next post we will modify some configuration files with the vi text editor, start to install some software with the apt-get command, and learn how to start/stop/restart services.

A little introduction.

I have been a network administrator now for about 3 years. I mainly work with Windows Servers and Windows based PCs, I have been playing with all sorts of different Linux distro's for about 6 years now. I never really got serious into Linux until I found Ubuntu Linux, and when I found Ubuntu Linux it struck me as a profound operating system because finally it intergrated the ease of use that has captured Windows users for so many years.

Now, I am not anti-Microsoft, anti-Apple, or anti-anything. I do, however, am getting sick of paying for so many licenses and renewals, it is just getting to expensive. This is what lead me to Linux as an alternative, but I am a simple person, and I was always hooked on GUI (pronounced gooey) interfaces for the ease of use. Even though I started out with an old Commodore 64 computer where all you had was command line. Linux was a different kind of command line compared to the Commodore 64 or DOS command line which I was very good at. The power Linux command line had though was unbelievable, and Ubuntu Linux was even better.

Ubuntu Linux is based on Debian Linux, and one of the best features of Debian Linux that I have had experience with is apt-get function. This function is used to download and install packages, also known as applications. To find out more about Debian Linux click here.

So now that is all out of the way, the purpose of this blog is going to be setting up and experimenting with different ways to setup a Ubuntu Linux Server. On this server we will install and setup an Apache Web Server, Email Server, MySQL database, PHP Bulletin Board, and some other reall y cool tools. I would also like to add that by no means am I an expert, I tend to describe myself as a jack of all trades, master of nothing. I'm an enthusiast of Ubuntu Linux and servers that can handle multiple loads.

In the next section of this blog I will post instructions on how to just install a base Ubuntu Linux Server. Here are some useful links that I will be referring to throughout this blog.

The Ubuntu Forums


The Perfect Setup - Ubuntu 6.06 LTS Server

Ubuntu Help - Mailserver


Ubuntu Help - Servers

I look forward to seeing how this turns out, and I welcome and encourage feedback.